//
//  TestViewController.m
//  TestConstriant
//
//  Created by apple on 2018/7/4.
//  Copyright © 2018年 apple. All rights reserved.
//

#import "TestViewController.h"
#import "TestListTableViewCell.h"
#import "TestOneViewController.h"
#import "TestTwoViewController.h"
#import "TestThreeViewController.h"
#import "TestFourThViewController.h"
@interface TestViewController ()
@property (weak, nonatomic) IBOutlet UITableView *listTableView;


@end

@implementation TestViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view.
    self.navigationItem.title = @"testList";
    self.listTableView.estimatedRowHeight = 50;
    self.listTableView.rowHeight = UITableViewAutomaticDimension;
    [self.listTableView registerNib:[UINib nibWithNibName:@"TestListTableViewCell" bundle:nil] forCellReuseIdentifier:@"cell_testList"];
    
}
- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
    return 6;
}
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    TestListTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"cell_testList" forIndexPath:indexPath];
    
    switch (indexPath.row) {
        case 0:
            cell.titleLabel.text = @"Constraint显示中间View";
            break;
            
        case 1:
            cell.titleLabel.text = @"Constraint显示中间View";
            break;
        case 2:
            cell.titleLabel.text = @"TestPickerView";
            break;
        case 3:
            cell.titleLabel.text = [NSString stringWithFormat:@"             %zi",indexPath.row];
            break;
        case 4:
            cell.titleLabel.text = [NSString stringWithFormat:@"             %zi",indexPath.row];
            break;
        default:
            break;
    }
    
    
    
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
   
    if (indexPath.row == 0) {
        TestOneViewController *vc = [[UIStoryboard storyboardWithName:@"test" bundle:nil] instantiateViewControllerWithIdentifier:@"TestOne"];
        vc.row =  -5;
        [self.navigationController showViewController:vc sender:nil];
    }
    if (indexPath.row == 1) {
        TestOneViewController *vc = [[UIStoryboard storyboardWithName:@"test" bundle:nil] instantiateViewControllerWithIdentifier:@"TestOne"];
        vc.row =  5;
        [self.navigationController showViewController:vc sender:nil];
    }
    if (indexPath.row == 2) {
        TestTwoViewController *vc = [[UIStoryboard storyboardWithName:@"test" bundle:nil] instantiateViewControllerWithIdentifier:@"TestTwo"];
        [self.navigationController showViewController:vc sender:nil];
    }
    if (indexPath.row == 3) {
        TestThreeViewController *vc = [[UIStoryboard storyboardWithName:@"test" bundle:nil] instantiateViewControllerWithIdentifier:@"TestThree"];
        [self.navigationController showViewController:vc sender:nil];
    }
    if (indexPath.row == 4) {
        TestFourThViewController *vc = [[UIStoryboard storyboardWithName:@"test" bundle:nil] instantiateViewControllerWithIdentifier:@"TestFourThViewController"];
        [self.navigationController showViewController:vc sender:nil];
    }
        
    
    
}


@end
